﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/header.js"></script>
    <script src="/lib/date/wdatepicker.js"></script>
</head>
<body style="background-color: white;">
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
            </div>
            <div class="pull-right">

            </div>
        </div>
        <!--高级搜索结束-->
        <div class="paging">
        </div>
    </div>

    <script type="text/x-dot-template" id="templatePager">
        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l wd120">公司名称</th>
                                <th class="t_l wd75">银行名称</th>
                                <th class="t_l wd150">银行卡号</th>
                                <th class="t_l wd75">用户名</th>

                                <th class="t_r wd75">金额</th>
                                <th class="t_r wd100">余额变化前</th>
                                <th class="t_r wd100">余额变化后</th>

                                <th class="t_l wd100">新增者</th>
                                <th class="t_c wd75">类别</th>
                                <th class="t_c wd150">新增时间</th>
                                <th class="t_l">新增说明</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td class="t_l wd120" title="{{=it.companyName }}"><input type="hidden" id="rid" name="rid" value="{{=it.rid}}">{{=it.companyName }}</td>
                                <td class="t_l wd75">{{= it.bankName }}</td>
                                <td class="t_l wd150" title="{{= FlashPay.Util.SubCardNumber(it.cardNumber) }}">{{= FlashPay.Util.SubCardNumber(it.cardNumber) }}</td>
                                <td class="t_l bold wd75">{{?  it.cardName}}{{= it.cardName }}{{??}}{{?}}</td>

                                <td class="t_r bold wd75">{{= it.amount }}</td>
                                <td class="t_r bold wd100">{{= it.beforeBalance }}</td>
                                <td class="t_r bold wd100">{{= it.afterBalance }}</td>

                                <td class="t_l wd100">{{?  it.createName}}{{= it.createName }}{{??}}{{?}}</td>
                                <td class="t_c wd75">{{= FlashPay.Util.GetAdjustStatusValue(it.adjustStatus) }}</td>
                                <td class="t_c wd150">{{= FlashPay.Util.FormatDate(it.createDbdate) }}</td>
                                <td class="t_l">{{?  it.createRemark}}{{= it.createRemark }}{{??}}{{?}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </script>
    <script type="text/javascript">

        var backCardId;
        var adjustBalanceRid;

        $(function () {

            backCardId = FlashPay.Util.GetQueryString("backCardId");
            adjustBalanceRid = FlashPay.Util.GetQueryString("adjustBalanceRid");

            FlashPay.UI.DataAutoHeight();

            $("#btnSearch").click(function () {
                FlashPay.UI.DoSearch();
            });

            FlashPay.UI.DoSearch();
            
        });

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                FlashPay.UI.DoSearch();
            }
        });

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function doSearch() {

            var cover = FlashPay.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });


            FlashPay.Util.Ajax({
                type: "POST",
                url: "/Payment/PaymentcardException?backCardId=" + backCardId + "&adjustBalanceRid=" + adjustBalanceRid,
                data: null,
                dataType: "json",
                success: function (response) {
                    if (response != null && response.success) {

                        cover.Remove();

                        var text = doT.template($("#templatePager").text());
                        $(".paging").html("");
                        $(".paging").append(text(response.data));

                    } else {
                        cover.Remove();

                        FlashPay.UI.Tip_short_warning(response.errorMessage);
                    }
                },
                error: function (e) {
                    cover.Remove();

                    FlashPay.UI.Tip_short_warning("操作失败！请查看网络，请重试！");
                }
            });
        }

        function save() {

            var rid = $("input[name='rid']").val();
            var data = {
                rid: rid
            };

            if (rid == undefined) {
                FlashPay.UI.Tip_short_warning("参数错误，请联系管理员！");
                return;
            }

            FlashPay.Util.Ajax({
                url: '/Payment/UpdateAdjustBalanceRID',
                type: 'POST',
                data: data,
                success: function (response) {
                    if (response.success) {
                        FlashPay.UI.DialogOpener().Tip_success("操作成功！");
                        FlashPay.UI.DialogOpener().doSearch();
                        FlashPay.UI.CloseDialog();
                    } else {
                        FlashPay.UI.Tip_short_warning("操作失败！" + response.errorMessage);
                    }
                },
                error: function (json) {
                    FlashPay.UI.Tip_short_warning("操作失败！请查看网络，请重试!");
                }
            });
        }
    </script>
</body>
</html>